package com.ceba.test.modules.usermanage.enums;

import com.ceba.test.base.language.ResourceUtils;
import org.apache.commons.lang.StringUtils;

public enum UserRoleEnum {
    DIGITAL_ENCRYPT("109", ResourceUtils.getMessage("ADMIN_DIGITAL_ENCRYPT")),
    VERIFYING_PLATFORM_ADMINISTATOR("200",ResourceUtils.getMessage("ADMIN_VERIFYING_PLATFORM_ADMINISTRATOR"));

    private UserRoleEnum(String code,String messages){
        this.code=code;
        this.messages=messages;
    }

    private String code;
    private String messages;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessages() {
        return messages;
    }

    public void setMessages(String messages) {
        this.messages = messages;
    }

    /**
     * 根据 falg标识取得枚举
     * @param code
     * @return
     */
    public static UserRoleEnum getUserRoleEnum(String code){
        for(int i=0;i<UserRoleEnum.values().length;i++){
            UserRoleEnum user=UserRoleEnum.values()[i];
            if(StringUtils.equals(user.getCode(), code)){
                return user;
            }
        }
        return null;
    }
}
